package com.xingkeduo.util.pojo.enums;

import com.xingkeduo.util.pojo.base.BaseEnum;

/**
 * 
 * @author GJ
 * @time 2019年4月3日 下午6:20:16
 * @description
 */
public enum MicroServicesEnum implements BaseEnum {
    ORDER(1, "订单中心"),
    COMMENTS(2, "评价标签"),
    OPERATION(3, "运营中心"),
    BUSINESSUSER(4, "用户中心"),
    BUSINESSCOMMON(5, "通用信息"),
    BUSINESSAUTHORITY(6, "授权中心");

    private int value;
    private String desc;

    private MicroServicesEnum(int value, String desc) {
        this.value = value;
        this.desc = desc;
    }

    public static boolean validValue(String value) {
        int value_int = Integer.parseInt(value);
        return validValue(value_int);
    }

    public static boolean validValue(int value) {
        MicroServicesEnum[] banks = values();

        for (int i = 0; i < banks.length; ++i) {
            if (banks[i].getValue() == value) {
                return true;
            }
        }

        return false;
    }

    public static MicroServicesEnum getBankValue(String value) {
        int value_int = Integer.parseInt(value);
        return getBankValue(value_int);
    }

    public static MicroServicesEnum getBankValue(int value) {
        MicroServicesEnum[] enums = values();

        for (int i = 0; i < enums.length; ++i) {
            if (enums[i].getValue() == value) {
                return enums[i];
            }
        }

        return null;
    }

    @Override
    public int getValue() {
        return this.value;
    }

    public String getDesc() {
        return this.desc;
    }
}
